<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {
  created() {
    if(sessionStorage.getItem("store")) {
      this.$store.replaceState(
        Object.assign(
          {},
          this.$store.state,
          JSON.parse(sessionStorage.getItem("store"))
        )
      )
      sessionStorage.removeItem("store");
    }
    window.addEventListener('beforeunload', ()=>{
      sessionStorage.setItem("store", JSON.stringify(this.$store.state));
    })
  },
  // watch: {
  //   $route:{
  //     handler(val){
  //       if(val.path == '/Case') {
  //         this.$store.commit('index', "案例");
  //       } else if(val.path == '/partner') {
  //         this.$store.commit('index', "合作商");
  //       }
  //     },
  //     // 深度观察监听
  //     deep: true
  //   }
  // }
}
</script>

<style lang="less">
*{
  margin: 0px;
  padding: 0px;
}
html,body{
  width: 100%;    
  height: 100%;   
  position: absolute; 
  left: 0;top: 0; 
  overflow: hidden;   
  overflow-y: auto;
  background-color: white;
  &::-webkit-scrollbar{ width: 0px; }
}

// 阿里字体图标设置，初始化
.icon, .iconfont {
  font-family:"iconfont" !important;
  font-size:16px;
  font-style:normal;
  -webkit-font-smoothing: antialiased;
  -webkit-text-stroke-width: 0.2px;
  -moz-osx-font-smoothing: grayscale;
}
</style>
